package com.ug_project.adapters

import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.ug_project.views.child



/**
 * Created by Administrator on 3/8/2017.
 */
object underLineItemDecoration : RecyclerView.ItemDecoration() {
    override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
        outRect.bottom = 1
    }

    override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
        val ex = parent.width.toFloat()
        val ey = parent.height.toFloat()
        val paint = Paint()
        paint.color = Color.GRAY
        parent.child.forEach {
            c.drawLine(0f, ey, ex, ey, paint)
        }

    }
}